/* =========================================================
   ClickHubTech Store — Client Portal Styles
   Indigo / Violet theme · Fully responsive
   ========================================================= */
:root {
    --cp-primary: #4f46e5;
    --cp-primary-dark: #4338ca;
    --cp-primary-50: #eef2ff;
    --cp-accent: #e11d48;
    --cp-dark: #0f172a;
    --cp-slate: #64748b;
    --cp-slate-light: #94a3b8;
    --cp-bg: #f1f5f9;
    --cp-card: #ffffff;
    --cp-sidebar-bg: #1e293b;
    --cp-border: #e2e8f0;
    --cp-success: #16a34a;
    --cp-warning: #b45309;
    --cp-radius: 16px;
    --cp-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
}

/* ---------- Base ---------- */
body.client-portal {
    background: var(--cp-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Header ---------- */
.cp-header {
    background: var(--cp-card);
    border-bottom: 1px solid var(--cp-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow:  1px 4px rgba(15, 23, 42, .04);
}
.cp-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 68px;
}
.cp-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.cp-brand-mark {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--cp-primary), #7c3aed);
    color: #fff;
    border-radius: 11px;
    display: grid; place-items: center;
    font-weight: 900; font-size: 16px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.cp-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.cp-brand-text strong { font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.cp-brand-text small { font-size: 11.5px; color: var(--cp-slate); font-weight: 500; }

.cp-nav { display: flex; align-items: center; gap: 4px; }
.cp-nav a {
    padding: 0px 0px;
    border-radius: 10px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--cp-slate);
    transition: .18s;
    white-space: nowrap;
}
.cp-nav a:hover { color: var(--cp-primary); background: var(--cp-primary-50); }
.cp-nav a.active { color: var(--cp-primary); background: var(--cp-primary-50); font-weight: 700; }
.cp-nav a.cp-logout { color: var(--cp-accent); }
.cp-nav a.cp-logout:hover { background: #fef2f2; }

.cp-user { display: flex; align-items: center; gap: 10px; }
.cp-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cp-primary), #7c3aed);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 800; font-size: 15px;
}
.cp-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.cp-user-name { font-weight: 700; font-size: 14px; color: var(--cp-dark); }

.cp-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none; border: none;
    padding: 8px;
}
.cp-toggle span {
    width: 22px; height: 2px;
    background: var(--cp-dark);
    border-radius: 2px;
    transition: .2s;
}

/* ---------- Shell and sidebar ---------- */
.cp-shell {
    display: flex;
    flex: 1;
    min-height: 0;
    align-items: stretch;
}
.cp-sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: var(--cp-sidebar-bg);
    color: #cbd5e1;
    border-right: 1px solid var(--cp-border);
    min-height: calc(100vh - 68px);
}
.cp-side {
    position: sticky;
    top: 68px;
    padding: 24px 14px;
}
.cp-side-group { margin-bottom: 24px; }
.cp-side-label {
    display: block;
    padding: 0 12px 8px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
}
.cp-side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 650;
    transition: .18s;
}
.cp-side-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.cp-side-link.active { color: #fff; background: var(--cp-primary); font-weight: 800; box-shadow: 0 4px 12px rgba(79, 70, 229, .35); }
.cp-side-ico { width: 22px; text-align: center; flex-shrink: 0; }
.cp-favorite-ico { color: #ef4444; font-size: 19px; line-height: 1; }
.cp-side-badge { margin-left: auto; min-width: 20px; padding: 2px 6px; border-radius: 999px; background: var(--cp-accent); color: #fff; font-size: 11px; text-align: center; }
.cp-side-logout { color: var(--cp-accent); }
.cp-overlay { display: none; }

/* ---------- Main ---------- */
.cp-main { flex: 1; min-width: 0; padding: 36px 44px 48px; }
.cp-main .container { max-width: 1120px; }

/* ---------- Page head ---------- */
.cp-page-head { margin-bottom: 26px; }
.cp-page-head h1 { font-size: 26px; font-weight: 900; letter-spacing: -.8px; }
.cp-page-head p { color: var(--cp-slate); margin-top: 4px; font-size: 14.5px; }

/* ---------- Welcome banner ---------- */
.cp-welcome {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
    color: #fff;
    border-radius: var(--cp-radius);
    padding: 28px 30px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
.cp-welcome::after {
    content: '';
    position: absolute;
    width: 260px; height: 260px;
    background: rgba(124, 58, 237, .35);
    border-radius: 50%;
    filter: blur(60px);
    top: -90px; right: -60px;
}
.cp-welcome h2 { font-size: 22px; font-weight: 900; letter-spacing: -.5px; position: relative; z-index: 1; }
.cp-welcome p { color: rgba(255, 255, 255, .8); margin-top: 6px; font-size: 14.5px; position: relative; z-index: 1; }

/* ---------- Stat grid ---------- */
.cp-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.cp-stat {
    background: var(--cp-card);
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--cp-shadow);
}
.cp-stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 24px;
    flex-shrink: 0;
}
.cp-stat-icon.blue { background: var(--cp-primary-50); }
.cp-stat-icon.green { background: #ecfdf5; }
.cp-stat-icon.amber { background: #fffbeb; }
.cp-stat-icon.purple { background: #f5f3ff; }
.cp-stat-value { font-size: 24px; font-weight: 900; letter-spacing: -.5px; line-height: 1.1; }
.cp-stat-label { font-size: 13px; color: var(--cp-slate); font-weight: 600; margin-top: 2px; }

/* ---------- Panel / card ---------- */
.cp-panel {
    background: var(--cp-card);
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius);
    padding: 26px;
    box-shadow: var(--cp-shadow);
    margin-bottom: 24px;
}
.cp-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.cp-panel-head h3 { font-size: 17px; font-weight: 800; }
.cp-panel-head .cp-link { color: var(--cp-primary); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.cp-panel-head .cp-link:hover { text-decoration: underline; }

/* ---------- Profile layout ---------- */
.cp-profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    gap: 24px;
    align-items: start;
}
.cp-profile-panel { margin-bottom: 0; }
.cp-profile-panel form { display: flex; flex-direction: column; }
.cp-profile-panel .cp-btn { align-self: flex-start; min-width: 140px; margin-top: 4px; }
.cp-profile-panel .cp-input:disabled { background: #f8fafc; color: var(--cp-slate); cursor: not-allowed; }
.cp-avatar-editor { display: flex; align-items: center; gap: 16px; padding: 14px; margin-bottom: 20px; background: #f8fafc; border: 1px solid var(--cp-border); border-radius: 12px; }
.cp-profile-avatar { width: 72px; height: 72px; flex: 0 0 72px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: linear-gradient(135deg, var(--cp-primary), #7c3aed); color: #fff; font-size: 26px; font-weight: 900; }
.cp-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cp-file-input { padding: 8px; font-size: 13px; }

/* ---------- Orders table ---------- */
.cp-table-wrap { overflow-x: auto; }
.cp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.cp-table th {
    text-align: left;
    padding: 12px 14px;
    background: #f8fafc;
    color: var(--cp-slate);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--cp-border);
    white-space: nowrap;
}
.cp-table td {
    padding: 14px;
    border-bottom: 1px solid var(--cp-border);
    vertical-align: middle;
}
.cp-table tbody tr:last-child td { border-bottom: none; }
.cp-table tbody tr:hover { background: #fafbff; }
.cp-table .order-no { font-weight: 800; color: var(--cp-primary); }
.cp-table .muted { color: var(--cp-slate); font-size: 13px; }

/* ---------- Status badges ---------- */
.cp-badge {
    display: inline-block;
    padding: 0px 0px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.status-pending    { background: #fffbeb; color: #b45309; }
.status-confirmed  { background: #eff6ff; color: #1d4ed8; }
.status-processing { background: #f5f3ff; color: #7c3aed; }
.status-shipped    { background: #ecfeff; color: #e749; }
.status-delivered  { background: #ecfdf5; color: #047857; }
.status-cancelled  { background: #fef2f2; color: #b91c1c; }

/* ---------- Buttons ---------- */
.cp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0px 0px;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    transition: .2s;
    cursor: pointer;
    line-height: 1.2;
}
.cp-btn-primary {
    background: linear-gradient(135deg, var(--cp-primary), #7c3aed);
    color: #fff;
    box-shadow: 0 6px 18px rgba(79, 70, 229, .35);
}
.cp-btn-primary:hover { filter: brightness(1.08); transform: translateY(-2px); }
.cp-btn-outline {
    background: transparent;
    color: var(--cp-primary);
    border: 1.5px solid var(--cp-primary);
}
.cp-btn-outline:hover { background: var(--cp-primary-50); }
.cp-btn-block { width: 100%; }
.cp-btn-sm { padding: 0px 0px; font-size: 13px; border-radius: 9px; }

/* ---------- Forms ---------- */
.cp-form-card {
    background: var(--cp-card);
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius);
    padding: 30px;
    box-shadow: var(--cp-shadow);
    max-width: 460px;
    margin: 0 auto;
}
.cp-form-card.wide { max-width: 640px; }
.cp-form-card h1 { font-size: 24px; font-weight: 900; letter-spacing: -.5px; margin-bottom: 6px; }
.cp-form-card .cp-sub { color: var(--cp-slate); font-size: 14px; margin-bottom: 24px; }
.cp-form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.cp-form-group label { font-size: 13.5px; font-weight: 700; color: var(--cp-dark); }
.cp-form-group label .req { color: var(--cp-accent); }
.cp-input {
    padding: 12px 14px;
    border: 1.5px solid var(--cp-border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: .15s;
    background: var(--cp-card);
    color: var(--cp-dark);
    width: 100%;
}
.cp-input:focus {
    outline: none;
    border-color: var(--cp-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
textarea.cp-input { resize: vertical; min-height: 90px; }
.cp-hint { font-size: 12.5px; color: var(--cp-slate-light); }
.cp-auth-alt { text-align: center; font-size: 14px; color: var(--cp-slate); margin-top: 18px; }
.cp-auth-alt a { color: var(--cp-primary); font-weight: 700; }

/* ---------- Alerts / toasts ---------- */
.cp-alert {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.cp-alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.cp-alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #99f6e4; }
.cp-alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Order detail ---------- */
.cp-order-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.cp-order-head h2 { font-size: 22px; font-weight: 900; letter-spacing: -.5px; }
.cp-order-ref {
    background: var(--cp-primary-50);
    color: var(--cp-primary-dark);
    font-weight: 800;
    font-size: 14px;
    padding: 14px 16px;
    border-radius: 999px;
}
.cp-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.cp-info-box {
    background: #f8fafc;
    border: 1px solid var(--cp-border);
    border-radius: 12px;
    padding: 16px;
}
.cp-info-box label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--cp-slate); display: block; margin-bottom: 6px; }
.cp-info-box .val { font-size: 15px; font-weight: 700; color: var(--cp-dark); }
.cp-info-box .val.small { font-size: 13.5px; font-weight: 600; }
.cp-timeline { margin: 20px 0 8px; }
.cp-timeline-step {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    position: relative;
}
.cp-timeline-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--cp-border);
    margin-top: 5px;
    -shrink: 0;
}
.cp-timeline-step.done .cp-timeline-dot { background: var(--cp-success); }
.cp-timeline-step.current .cp-timeline-dot { background: var(--cp-primary); box-shadow:    4px rgba(79, 70, 229, .2); }
.cp-timeline-step.cancelled .cp-timeline-dot { background: var(--cp-accent); }
.cp-timeline-label { font-weight: 700; font-size: 14px; }
.cp-timeline-label small { display: block; color: var(--cp-slate); font-weight: 500; font-size: 12.5px; }

/* ---------- Item list ---------- */
.cp-items { display: flex; flex-direction: column; gap: 10px; }
.cp-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--cp-border);
    border-radius: 12px;
    background: #fafbff;
}
.cp-item-img {
    width: 52px; height: 52px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    display: grid; place-items: center;
    overflow: hidden;
    -shrink: 0;
}
.cp-item-img img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.cp-item-img .ph { font-size: 22px; }
.cp-item-name { font-weight: 700; font-size: 14.5px; flex: 1; min-width: 0; }
.cp-item-qty { color: var(--cp-slate); font-size: 13px; white-space: nowrap; }
.cp-item-price { font-weight: 800; font-size: 14.5px; white-space: nowrap; }

/* ---------- Totals ---------- */
.cp-totals { margin-top: 20px; }
.cp-total-row { display: flex; justify-content: space-between; padding: 0px 0px; font-size: 14px; color: var(--cp-slate); }
.cp-total-row.grand {
    border-top: 2px solid var(--cp-border);
    margin-top: 8px;
    padding-top: 14px;
    font-weight: 800;
    color: var(--cp-dark);
    font-size: 17px;
}
.cp-total-row.grand span:last-child { color: var(--cp-primary); }

/* ---------- Empty state ---------- */
.cp-empty {
    text-align: center;
    padding: 28px 24px;
    background: var(--cp-card);
    border: 1px dashed var(--cp-border);
    border-radius: var(--cp-radius);
}
.cp-empty .emoji { font-size: 48px; margin-bottom: 12px; }
.cp-empty h3 { font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.cp-empty p { color: var(--cp-slate); font-size: 14px; margin-bottom: 20px; }

/* ---------- Footer ---------- */
.cp-footer {
    background: var(--cp-dark);
    color: var(--cp-slate-light);
    padding: 0px 0px;
    margin-top: auto;
}
.cp-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
    flex-wrap: wrap;
}
.cp-footer a { color: #fff; font-weight: 600; }
.cp-footer a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .cp-main { padding: 28px 32px 40px; }
    .cp-welcome { padding: 24px; }
    .cp-profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .cp-header-inner { min-height: 64px; }
    .cp-shell { position: relative; }
    .cp-sidebar {
        position: fixed;
        top: 64px;
        bottom: 0;
        left: 0;
        width: min(82vw, 290px);
        min-height: 0;
        z-index: 120;
        box-shadow: 12px 0 30px rgba(15, 23, 42, .14);
        transform: translateX(-105%);
        transition: transform .28s ease;
        overflow-y: auto;
    }
    .cp-sidebar.open { transform: translateX(0); }
    .cp-side { position: static; padding: 20px 14px 28px; }
    .cp-overlay {
        display: block;
        position: fixed;
        inset: 64px 0 0;
        z-index: 110;
        background: rgba(15, 23, 42, .42);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .2s ease, visibility .2s ease;
    }
    .cp-overlay.show {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .cp-main { width: 100%; padding: 24px 20px 36px; }
    .cp-profile-panel { padding: 20px; }
    .cp-nav {
        position: fixed;
        top: 68px;
        left: 0; right: 0;
        background: var(--cp-card);
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px 20px;
        gap: 4px;
        border-bottom: 1px solid var(--cp-border);
        box-shadow: var(--cp-shadow);
        transform: translateY(-130%);
        transition: transform .3s ease;
        z-index: 99;
        max-height: calc(100vh - 68px);
        overflow-y: auto;
    }
    .cp-nav.open { transform: translateY(0); }
    .cp-nav a { padding: 0px 0px; border-radius: 10px; }
    .cp-toggle { display: flex; }
    .cp-user { display: none; }
    .cp-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .cp-stat { padding: 16px; gap: 12px; }
    .cp-stat-value { font-size: 20px; }
    .cp-panel { padding: 20px; }
    .cp-panel-head { flex-wrap: wrap; }
    .cp-page-head h1 { font-size: 22px; }
    .cp-info-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .cp-main { padding: 20px 16px 32px; }
    .cp-welcome { padding: 20px; }
    .cp-welcome h2 { font-size: 18px; }
    .cp-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .cp-stat { padding: 14px; gap: 10px; }
    .cp-stat-icon { width: 40px; height: 40px; font-size: 20px; }
    .cp-stat-value { font-size: 18px; }
    .cp-stat-label { font-size: 12px; }
    .cp-form-card { padding: 0px 0px; }
    .cp-info-grid { grid-template-columns: 1fr; }
    .cp-order-head { flex-direction: column; align-items: flex-start; }
    .cp-item { flex-wrap: wrap; }
    .cp-footer-inner { flex-direction: column; text-align: center; }
    .cp-table th, .cp-table td { padding: 10px; }
    .cp-table { font-size: 13px; }
}
